// 引入封装好的axios
import {http} from '@/utils/request.js'

// 首页轮播图
export function swipers() {
  return http('/api/bannerList','get')
}

// 首页最新商品
export function news() {
  return http('/api/goods/is_new/1','get')
}

// 首页推荐商品
export function gives() {
  return http('/api/goods/is_recommend/1','get')
}

// 商品详情
export function details(id) {
	console.log(id)
  return http(`/api/goods/detail/${id}`,'get')
}

// 购物车列表
export function carts(memberid) {
	// console.log(id)
  return http(`/api/getCartList?member_id=${memberid}`,'get')
}

// 商品搜索
export function searchcarts(value) {
	// console.log(id)
  return http(`/api/goods/search/1/${value}`,'get')
}

// 分类列表商品
export function cartmenus(id) {
	// console.log(id)
  return http(`/api/goods/getMenuGoodsList/4/${id}`,'get')
}

// 登录页面
export function mineusers(value) {
	// console.log(id)
  return http(`/api/login/?phone=${value}`,'post')
}

// 添加购物车
export function addcarts(addcartmenu) {
	// console.log(id)
	console.log(addcartmenu)
  return http(`/api/addcart/?goods_id=${addcartmenu.goods_id}&goods_name=${addcartmenu.goods_name}&price=${addcartmenu.shop_price}&number=1&goods_img=${addcartmenu.original_img}&member_id=${addcartmenu.member_id}`,'post')
}

// 购物车删除
export function removecarts(id) {
	console.log(id)
  return http(`/api/deletecart/?id=${id}`,'get')
}

// 清空购物车
export function removealls(id) {
	console.log(id)
  return http(`/api/clearcart/?member_id=${id}`,'get')
}

export function test(){
	return '靳记龙'
}
